using Microsoft.AspNetCore.Mvc;
using MvcDemo.Models;
using MvcDemo.Services;

namespace MvcDemo.Controllers;

[ApiController]
[Route("[controller]")]
public class WebServiceController {
    private readonly IDemoModelService _demoModelService;

    public WebServiceController(IDemoModelService demoModelService) {
        _demoModelService = demoModelService;
    }

    [Route("get")]
    [HttpGet]
    public ActionResult<DemoModel> Get() =>
        new DemoModel { Id = 20000, Name = "Another Name" };

    [Route("get/{id}")]
    [HttpGet]
    public ActionResult<DemoModel> Get(int id) => _demoModelService.Get(id);
}